using System;

namespace ZFramework
{
    public static class MathUtil
    {
        public static (float min, float max) MinMax(float a, float b) => a < b ? (a, b) : (b, a);
        public static (T min, T max) MinMax<T>(T a, T b, Func<T, T, bool> less) => less(a, b) ? (a, b) : (b, a);
        public static T Min<T>(T a, T b, Func<T, T, bool> less) => less(a, b) ? a : b;
        public static T Max<T>(T a, T b, Func<T, T, bool> less) => less(a, b) ? b : a;
    }
}